package cn.dong.ucenter.controller.admin;

import cn.dong.api.domain.CommonResult;
import cn.dong.ucenter.service.MemberService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ucenter/member")
@Slf4j
public class MemberController {

    @Autowired
    private MemberService memberService;

    /**
     * 获取今天的用户注册数量
     * @param day
     * @return
     */
    @GetMapping("/getRegisterCountByDay/{day}")
    public CommonResult getRegisterCountByDay(@PathVariable String day){
        Integer count = memberService.getRegisterCountByDay(day);
        return CommonResult.ok().data(count);
    }

    /**
     * 获取今天的用户登录数量
     * @param day
     * @return
     */
    @GetMapping("/getLoginCountByDay/{day}")
    public CommonResult getLoginCountByDay(@PathVariable String day){
        Integer count = memberService.getLoginCountByDay(day);
        return CommonResult.ok().data(count);
    }



}
